/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.room.maubinh;

import extension.game.room.RoomExtension;
import extension.maubinh.handler.ExchangeCardHandler;
import extension.maubinh.handler.FinishShowResultHandler;
import extension.maubinh.handler.MauBinhCommand;
import extension.maubinh.handler.StartGameHandler;

/**
 *
 * @author daz
 */
public class MauBinhExtension extends RoomExtension {

    private MauBinhGame mauBinhGame;
    private MauBinhResponse response;

    @Override
    public void init() {
        prefixLength = 2;
        startupRoom();
    }

    @Override
    public void addHandler() {
        super.addHandler();
        addRequestHandler(MauBinhCommand.EXCHANGE_CARD, ExchangeCardHandler.class);
        addRequestHandler(MauBinhCommand.START_GAME, StartGameHandler.class);
        addRequestHandler(MauBinhCommand.FINISH_RESULT, FinishShowResultHandler.class);
    }

    @Override
    public MauBinhGame getGame() {
        return this.mauBinhGame;
    }

    @Override
    public void initGame(int roomId) {
        response = new MauBinhResponse(this);
        mauBinhGame = new MauBinhGame(this, roomId);
        mauBinhGame.start();
//        phomGame.start();
    }

    @Override
    public MauBinhResponse getResponse() {
        return this.response;
    }
}
